package com.journaldev.threadpool;

/**
 * 一个工作线程demo
 * @author:chenhs E-mail:hson08_chen@163.com
 * Created on 2017年9月8日 上午11:30:19
 */
public class WorkerThread implements Runnable {
	
	private String command;
	
	public WorkerThread(String command) {
		this.command = command;
	}

	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName()+" Start. Command = "+ command);
		proccessCommand();
		System.out.println(Thread.currentThread().getName()+" End. ");
	}

	private void proccessCommand() {
		try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	@Override
	public String toString() {
		return "WorkerThread [command=" + command + "]";
	}
	
	
}
